package com.alibaba.excel.support;

import com.alibaba.excel.domain.Dict;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author lxk
 * @date 2022/10/14
 * @description
 */
public class ExcelDictContextHolder {
   public static final Map<String,List<Dict>> dictMap = new ConcurrentHashMap();

   public static List<Dict> getByDictType(String dictType){
       return dictMap.get(dictType);
   }

   public static void load(Map<String,List<Dict>> map){
       dictMap.clear();
       dictMap.putAll(map);;
   }

    public static void put(String key,List value){
        dictMap.put(key, value);;
    }

    public static void clear(){
        dictMap.clear();
    }

    public static void remove(Object key){
        dictMap.remove(key);
    }

    public static boolean isEmpty(){
       return dictMap == null || dictMap.isEmpty();
    }
}
